#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
	if(argc!=4)
	{
		cout << "Use: Table file, output, batch file" << endl;
		return 1;
	}

	ifstream table(argv[1]);
	if(!table)
	{
		cout << "Failed to load table." << endl;
		return 1;
	}

	ofstream output(argv[3]);
	
	int size;
	table >> size;
	for(int s=0;s<size;s++)
	{
		string tname;
		table >> tname;
		output << "csp.out -t " << tname << " >" << argv[2] << '.' << tname << ".result" << endl 
				<< "echo Completed table " << tname << endl << endl;
	}
	output.close();
}
